package ink.lovejinhu.leetcode;

public class Solution_0762 {
    public int countPrimeSetBits(int left, int right) {
        int res = 0;
        for (int i = left; i <= right; i++) {
            int i1 = Integer.bitCount(i);
            if (isZhishu(i1)) {
                res++;
            }
        }
        return res;
    }

    public boolean isZhishu(int x) {
        if (x < 2) {
            return false;
        }
        for (int i = 2; i <= x / i; i++) {
            if (x % i == 0) {
                return false;
            }
        }
        return true;
    }
}
